package com.hit.sys.modular.auth.service;

import com.hit.core.pojo.login.SysLoginUser;
import com.hit.sys.modular.user.entity.SysUser;
import org.springframework.security.core.Authentication;

import javax.servlet.http.HttpServletRequest;

public interface AuthService {

    String login(String account, String password);

    String doLogin(SysUser sysUser);

    /**
     * 从request获取token
     *
     * @param request request
     * @return token
     */
    String getTokenFromRequest(HttpServletRequest request);

    /**
     * 根据token获取登录用户信息
     *
     * @param token token
     * @return 当前登陆的用户信息
     */
    SysLoginUser getLoginUserByToken(String token);

    void setSpringSecurityContextAuthentication(SysLoginUser sysLoginUser);

    Authentication getAuthentication();
}
